#!/bin/bash
function oper_modeColor(){
    for file in $1/*
    do
#      echo "$file"
      if [[ $file =~ " " ]]
      then
          continue
      fi
      if [ -f "$file" ]
      then
        if [[ "$file" == *.xib* ]]
        then
            echo "$file"
            sed -i "" "s/<color key=(.*) name=\"usc_color_dark_text\"\/>/a/g" $file
        fi
      else
          if [ "`ls -A $file`" != "" ]
          then
              oper_modeColor "$file"
          fi
      fi
    done
}

function oper_modeColor2(){
#source="name=\"DINAlternate-Bold\" family=\"DIN Alternate\""
    Source="<color key=\"textColor\" name=\"psx_color_dark_text\"/>"
    target="<color key=\"textColor\" white=\"0.0\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"genericGamma22GrayColorSpace\"/>"
    path=$1
    grep -rl "$Source" $path | xargs gsed -i "" 's/'"$Source"'/'"$target"'/g'
}
read -p "路径：" path
oper_modeColor2 $path
